<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>ChatLayoutAttributes.swift - Slather</title>
<link href="slather.css" media="all" rel="stylesheet">
</head>
<body>
<header><div class="row"><a href="index.html"><img src="logo.jpg" alt="Slather logo"></a></div></header><div class="row"><div id="reports">
<h2 class="cov_title">
<span>Coverage for "ChatLayoutAttributes.swift" : </span><span class="cov_low">19.61%</span>
</h2>
<h4 class="cov_subtitle">(10 of 51 relevant lines covered)</h4>
<h4 class="cov_filepath">ChatLayout/Classes/Core/ChatLayoutAttributes.swift</h4>
<table class="source_code">
<tr class="never">
<td class="num">1</td>
<td class="src"><pre><code class="objc">//</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">2</td>
<td class="src"><pre><code class="objc">// ChatLayout</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">3</td>
<td class="src"><pre><code class="objc">// ChatLayoutAttributes.swift</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">4</td>
<td class="src"><pre><code class="objc">// https://github.com/ekazaev/ChatLayout</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">5</td>
<td class="src"><pre><code class="objc">//</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">6</td>
<td class="src"><pre><code class="objc">// Created by Eugene Kazaev in 2020-2023.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">7</td>
<td class="src"><pre><code class="objc">// Distributed under the MIT license.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">8</td>
<td class="src"><pre><code class="objc">//</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">9</td>
<td class="src"><pre><code class="objc">// Become a sponsor:</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">10</td>
<td class="src"><pre><code class="objc">// https://github.com/sponsors/ekazaev</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">11</td>
<td class="src"><pre><code class="objc">//</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">12</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">13</td>
<td class="src"><pre><code class="objc">import Foundation</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">14</td>
<td class="src"><pre><code class="objc">import UIKit</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">15</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">16</td>
<td class="src"><pre><code class="objc">/// Custom implementation of `UICollectionViewLayoutAttributes`</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">17</td>
<td class="src"><pre><code class="objc">public final class ChatLayoutAttributes: UICollectionViewLayoutAttributes {</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">18</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">19</td>
<td class="src"><pre><code class="objc">    /// Alignment of the current item. Can be changed within `UICollectionViewCell.preferredLayoutAttributesFitting(...)`</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="covered">
<td class="num">20</td>
<td class="src"><pre><code class="objc">    public var alignment: ChatItemAlignment = .fullWidth</code></pre></td>
<td class="coverage">354x</td>
</tr>
<tr class="never">
<td class="num">21</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">22</td>
<td class="src"><pre><code class="objc">    /// `CollectionViewChatLayout`s additional insets setup using `ChatLayoutSettings`. Added for convenience.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="covered">
<td class="num">23</td>
<td class="src"><pre><code class="objc">    public internal(set) var additionalInsets: UIEdgeInsets = .zero</code></pre></td>
<td class="coverage">354x</td>
</tr>
<tr class="never">
<td class="num">24</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">25</td>
<td class="src"><pre><code class="objc">    /// `UICollectionView`s frame size. Added for convenience.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="covered">
<td class="num">26</td>
<td class="src"><pre><code class="objc">    public internal(set) var viewSize: CGSize = .zero</code></pre></td>
<td class="coverage">354x</td>
</tr>
<tr class="never">
<td class="num">27</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">28</td>
<td class="src"><pre><code class="objc">    /// `UICollectionView`s adjusted content insets. Added for convenience.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="covered">
<td class="num">29</td>
<td class="src"><pre><code class="objc">    public internal(set) var adjustedContentInsets: UIEdgeInsets = .zero</code></pre></td>
<td class="coverage">354x</td>
</tr>
<tr class="never">
<td class="num">30</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">31</td>
<td class="src"><pre><code class="objc">    /// `CollectionViewChatLayout`s visible bounds size excluding `adjustedContentInsets`. Added for convenience.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="covered">
<td class="num">32</td>
<td class="src"><pre><code class="objc">    public internal(set) var visibleBoundsSize: CGSize = .zero</code></pre></td>
<td class="coverage">354x</td>
</tr>
<tr class="never">
<td class="num">33</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">34</td>
<td class="src"><pre><code class="objc">    /// `CollectionViewChatLayout`s visible bounds size excluding `adjustedContentInsets` and `additionalInsets`. Added for convenience.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="covered">
<td class="num">35</td>
<td class="src"><pre><code class="objc">    public internal(set) var layoutFrame: CGRect = .zero</code></pre></td>
<td class="coverage">354x</td>
</tr>
<tr class="never">
<td class="num">36</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">37</td>
<td class="src"><pre><code class="objc">    #if DEBUG</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">38</td>
<td class="src"><pre><code class="objc">    var id: UUID?</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">39</td>
<td class="src"><pre><code class="objc">    #endif</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">40</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="missed">
<td class="num">41</td>
<td class="src"><pre><code class="objc">    convenience init(kind: ItemKind, indexPath: IndexPath = IndexPath(item: 0, section: 0)) {</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">42</td>
<td class="src"><pre><code class="objc">        switch kind {</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">43</td>
<td class="src"><pre><code class="objc">        case .cell:</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">44</td>
<td class="src"><pre><code class="objc">            self.init(forCellWith: indexPath)</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">45</td>
<td class="src"><pre><code class="objc">        case .header:</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">46</td>
<td class="src"><pre><code class="objc">            self.init(forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, with: indexPath)</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">47</td>
<td class="src"><pre><code class="objc">        case .footer:</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">48</td>
<td class="src"><pre><code class="objc">            self.init(forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, with: indexPath)</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">49</td>
<td class="src"><pre><code class="objc">        }</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">50</td>
<td class="src"><pre><code class="objc">    }</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="never">
<td class="num">51</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">52</td>
<td class="src"><pre><code class="objc">    /// Returns an exact copy of `ChatLayoutAttributes`.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="missed">
<td class="num">53</td>
<td class="src"><pre><code class="objc">    public override func copy(with zone: NSZone? = nil) -&gt; Any {</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">54</td>
<td class="src"><pre><code class="objc">        let copy = super.copy(with: zone) as! ChatLayoutAttributes</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">55</td>
<td class="src"><pre><code class="objc">        copy.viewSize = viewSize</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">56</td>
<td class="src"><pre><code class="objc">        copy.alignment = alignment</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">57</td>
<td class="src"><pre><code class="objc">        copy.layoutFrame = layoutFrame</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">58</td>
<td class="src"><pre><code class="objc">        copy.additionalInsets = additionalInsets</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">59</td>
<td class="src"><pre><code class="objc">        copy.visibleBoundsSize = visibleBoundsSize</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">60</td>
<td class="src"><pre><code class="objc">        copy.adjustedContentInsets = adjustedContentInsets</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">61</td>
<td class="src"><pre><code class="objc">        #if DEBUG</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">62</td>
<td class="src"><pre><code class="objc">        copy.id = id</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">63</td>
<td class="src"><pre><code class="objc">        #endif</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">64</td>
<td class="src"><pre><code class="objc">        return copy</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">65</td>
<td class="src"><pre><code class="objc">    }</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="never">
<td class="num">66</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">67</td>
<td class="src"><pre><code class="objc">    /// Returns a Boolean value indicating whether two `ChatLayoutAttributes` are considered equal.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="covered">
<td class="num">68</td>
<td class="src"><pre><code class="objc">    public override func isEqual(_ object: Any?) -&gt; Bool {</code></pre></td>
<td class="coverage">18x</td>
</tr>
<tr class="covered">
<td class="num">69</td>
<td class="src"><pre><code class="objc">        super.isEqual(object)</code></pre></td>
<td class="coverage">18x</td>
</tr>
<tr class="covered">
<td class="num">70</td>
<td class="src"><pre><code class="objc">            &amp;&amp; alignment == (object as? ChatLayoutAttributes)?.alignment</code></pre></td>
<td class="coverage">18x</td>
</tr>
<tr class="covered">
<td class="num">71</td>
<td class="src"><pre><code class="objc">    }</code></pre></td>
<td class="coverage">18x</td>
</tr>
<tr class="never">
<td class="num">72</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">73</td>
<td class="src"><pre><code class="objc">    /// `ItemKind` represented by this attributes object.</code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="missed">
<td class="num">74</td>
<td class="src"><pre><code class="objc">    public var kind: ItemKind {</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">75</td>
<td class="src"><pre><code class="objc">        switch (representedElementCategory, representedElementKind) {</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">76</td>
<td class="src"><pre><code class="objc">        case (.cell, nil):</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">77</td>
<td class="src"><pre><code class="objc">            return .cell</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">78</td>
<td class="src"><pre><code class="objc">        case (.supplementaryView, .some(UICollectionView.elementKindSectionHeader)):</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">79</td>
<td class="src"><pre><code class="objc">            return .header</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">80</td>
<td class="src"><pre><code class="objc">        case (.supplementaryView, .some(UICollectionView.elementKindSectionFooter)):</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">81</td>
<td class="src"><pre><code class="objc">            return .footer</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">82</td>
<td class="src"><pre><code class="objc">        default:</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">83</td>
<td class="src"><pre><code class="objc">            preconditionFailure("Unsupported element kind.")</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">84</td>
<td class="src"><pre><code class="objc">        }</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">85</td>
<td class="src"><pre><code class="objc">    }</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="never">
<td class="num">86</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="missed">
<td class="num">87</td>
<td class="src"><pre><code class="objc">    func typedCopy() -&gt; ChatLayoutAttributes {</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">88</td>
<td class="src"><pre><code class="objc">        guard let typedCopy = copy() as? ChatLayoutAttributes else {</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">89</td>
<td class="src"><pre><code class="objc">            fatalError("Internal inconsistency.")</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">90</td>
<td class="src"><pre><code class="objc">        }</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">91</td>
<td class="src"><pre><code class="objc">        return typedCopy</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="missed">
<td class="num">92</td>
<td class="src"><pre><code class="objc">    }</code></pre></td>
<td class="coverage">!</td>
</tr>
<tr class="never">
<td class="num">93</td>
<td class="src"><pre><code class="objc"></code></pre></td>
<td class="coverage"></td>
</tr>
<tr class="never">
<td class="num">94</td>
<td class="src"><pre><code class="objc">}</code></pre></td>
<td class="coverage"></td>
</tr>
</table>
</div></div>
<footer><div class="row">
<p><a href="https://github.com/SlatherOrg/slather">Fork me on Github</a></p>
<p>&copy; 2023 Slather</p>
</div></footer><script src="highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script>
</body>
</html>
